/*
 * ClipArea.hpp
 *
 *  Created on: 11-12-2010
 *      Author: Piotr
 */

#pragma once

#include "geometry/Rectangle.hpp"
#include "Control.hpp"

/*
 * Represents a rectangular area of the control. Uses glScissor to crop the drawing area to the given
 * rectangle. Used for simple container in order not to draw outside of it.
 */
class ClipArea
{
	private:
		geometry::Rectangle clip;
		float xShift;
		float yShift;

	public:
		static geometry::Rectangle rootClip;

		ClipArea();
		ClipArea(const geometry::Rectangle& clip, float xShift, float yShift);
		ClipArea(const ClipArea& clipArea);

		ClipArea getUpdatedByControl(const Control& control) const;
		void setGLClipArea() const;

		void shift(const Vector& shiftVec);

		float getX() const;
		float getY() const;
		float getWidth() const;
		float getHeight() const;

		~ClipArea();
};
